// 代理服务器
// 解决跨域问题
const express = require('express')
const { createProxyMiddleware } = require('http-proxy-middleware')

const app = express()

// 配置代理
app.use('/api', createProxyMiddleware({
  target: 'http://localhost:8081',
  changeOrigin: true,
  pathRewrite: {
    '^/api': ''
  }
}))

const port = 3000
app.listen(port, () => {
  console.log(`代理服务器已启动，端口号为： ${port}`)
})
